<extend name="Public:office" />
<block name="title">
    <title>团队信息</title>
</block>
<block name="header_styles">
    <style type="text/css">
        .main-wrapper .container {
            background-color: #ffffff;
        }

        .link-question {
            -moz-border-radius: 15px;
            -webkit-border-radius: 15px;
            border-radius: 15px;
            display: inline-block;
            padding: 0px 5px;
        }
    </style>
</block>
<block name="main">
    <div class="tabs-wrapper">
        <include file="Team:menu" />
        <div class="tab-content">
            <div class="tab-pane active" style="min-height: 600px;">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        未通知客服发放的职位
                    </div>
                    <table class="table table-bordered" id="tbMembers">
                        <tr>
                            <th style="width:100px;text-align:center;vertical-align: middle;">
                                <label class="checkbox-inline">
                                    <input type="checkbox" id="cbSelectAll" />全选
                                </label>
                            </th>
                            <th colspan="3">
                                <button type="button" class="btn btn-default" id="btnSubmit"><i class="fa fa-cny"></i> 发放薪酬</button>&nbsp;&nbsp;
                                <a href="javascript:;" class="link-question tuo-guang"><i class="fa fa-question"></i></a>
                            </th>
                        </tr>
                        <volist name="unced" id="ucitem">
                        <tr>
                            <th style="text-align:center;vertical-align: middle;" rowspan="2">
                                <input type="checkbox" data-name="{$ucitem.uname}" data-userid="{$ucitem.id}" />
                            </th>
                            <td colspan="3">
                                <span style="font-size:20px;">{$ucitem.uname}</span>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <strong>职位：</strong>{$ucitem.name}
                            </td>
                            <td>
                                <strong>薪酬额:</strong>￥{$ucitem.salary}
                            </td>
                            <td>
                                <strong>薪酬状态:</strong>{:toTuoguanDesc($ucitem['moneyin'], true, $ucitem['pay'])}
                            </td>
                        </tr>
                        </volist>

                        <tr>
                            <th style="text-align:center;vertical-align: middle;" rowspan="100%">
                                <input type="checkbox" data-name="{$ucitem.uname}" data-userid="{$ucitem.id}" />
                            </th>
                            <td colspan="3">
                                <span style="font-size:20px;">AAA</span>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <strong>职位：</strong>UI工程师
                            </td>
                            <td>
                                <strong>薪酬额:</strong>￥40000
                            </td>
                            <td>
                               
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="checkbox" name="" checked disabled="disabled"/> 第一期
                            </td>
                            <td>
                                <span>薪酬额:</span> 4000RMB
                            </td>
                            <td>
                                <span>薪酬状态:</span> 已结算
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="checkbox" name="" /> 第二期
                            </td>
                            <td>
                                <span>薪酬额:</span> 4000RMB
                            </td>
                            <td>
                                <span>薪酬状态:</span> 已结算
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="checkbox" name="" /> 第三期
                            </td>
                            <td>
                                <span>薪酬额:</span> 4000RMB
                            </td>
                            <td>
                                <span>薪酬状态:</span> 已结算
                            </td>
                        </tr>
                    </table>
                </div>

                <div class="panel panel-default">
                    <div class="panel-heading">
                        已通知客服发放的职位
                    </div>
                    <table class="table table-bordered" id="tbMembers">
                        <volist name="ced" id="citem">
                        <tr>
                            <td colspan="3">
                                <span style="font-size:20px;">{$citem.uname}</span>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <strong>职位：</strong>{$citem.name}
                            </td>
                            <td>
                                <strong>薪酬额:</strong>￥{$citem.salary}
                            </td>
                            <td>
                                <strong>薪酬状态:</strong>{:toTuoguanDesc($citem['moneyin'], true, $citem['pay'])}
                            </td>
                        </tr>
                        </volist>
                    </table>
                </div>
                
                <div class="panel panel-default">
                    <div class="panel-heading">
                        客服已向雇员发放的职位
                    </div>
                    <table class="table table-bordered" id="tbMembers">
                        <volist name="ped" id="citem">
                        <tr>
                            <td colspan="3">
                                <span style="font-size:20px;">{$citem.uname}</span>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <strong>职位：</strong>{$citem.name}
                            </td>
                            <td>
                                <strong>薪酬额:</strong>￥{$citem.salary}
                            </td>
                            <td>
                                <strong>薪酬状态:</strong>{:toTuoguanDesc($citem['moneyin'], true, $citem['pay'])}
                            </td>
                        </tr>
                        </volist>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div style="display: none;">
        <div id="tooltipcontent1" class="tooltipcontent1">
            <div style="width:300px;text-align:left;">
                点击“发放薪酬”即表示您同意把薪酬支付给人才，般若虾人工客服会跟您联系再次确认，确认过后，就将托管的资金汇至人才账户。
            </div>
        </div>
    </div>
</block>
<block name="footer_scripts">
    <script type="text/javascript">
        require(["jquery", "modules/message"], function($, messageBox){
            $(function () {
                $("#btnSubmit").click(function () {
                    //用户ID 数组
                    var userArray = Array();
                    var msg = "确定要向以下人员发放薪酬吗？";
                    msg += "<div style='text-align:left;padding-left:70px;'>";
                    $("#tbMembers input:not(#cbSelectAll):checked").each(function () {
                        var name = $(this).data("name");
                        var userid = $(this).data("userid");
                        userArray.push(userid);
                        msg += "<br/>" + name;
                    });
                    msg += "</div>";

                    if($(userArray).length<=0){
                        return false;
                    }

                    messageBox.confirm({
                        title: "确认", content: msg, sure: function () {

                            //提交数据
                            $.ajax({
                                url: "{:U('Team/paysalary_ajax')}",
                                dataType: "json",
                                type: "post",
                                data: {'jobs':userArray},
                                success: function (data) {
                                    var vdata = eval(data);
                                    messageBox.alert({content:vdata.msg, sure:function(){if(vdata.success==1){window.location.reload();}$.fancybox.close();}});
                                }
                            });
                        }
                    });
                });

                $("#cbSelectAll").click(function () {
                    var isChecked = $(this).is(":checked");
                    $("#tbMembers input:not(#cbSelectAll)").each(function () {
                        $(this).get(0).checked = isChecked;
                    });
                });
            });
        });
    </script>
</block>